package top.lvkun.pay.alipayconfig;

import java.io.FileWriter;
import java.io.IOException;

/**
 * 支付宝的配置常量
 * @author Administrator
 * @version 1.0
 * @date 2021/1/22 11:53
 */
public class AlipayConfig {
    //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2021000117602994";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCrhOj+vVwywoXcew5EtiVRvWjRZ5cs/ZB/MwFvJTbcbFXbwCgBwL2fmCWbMFE7bwjYSZ20D0JWfvV1UOjBwQLmubms2UODTU3bnSY7c9W0ECDJHYaky+mi2X9GOdYGa58uoNW2oefADyU5Y8ymxa3++repVhDf+vql/GaY5KTjM/ZDUEpZxrtxfkknAX1E0ufjnE04BhTWiGOhuyluxhQ8OYGFFv5x7Diouk8gVwlLwNncEOC7RUVt03ZkY40+lzfWkpF1yqv7nmDvm8A55jmBp3vqcsVQy8jt3Sck+EiT+zkoGyFuDIWP1NYSsHq1O63XA3O0zvu9pgijniTFF3/VAgMBAAECggEAaHaDnZrhC31UIAvGjezN3/HXZCqOdXVdy0raZcIpnqhQxo1LEH4+P3Rf+xu7bdJbdbeoWCEvCxU6FCCaEl+mj7WwM2kD6HVtpQMaZP1Qu+FSxoq4Fain/GoxTSkuhCyJ/9EvOJN1XZEb3887tpsRNQmoUHc9wdzPScbnCdm/3ywjT+6JEJSU4B7K/GzQYn9jGtnUE6sNZjhbDgnoa3mI0itFRAftOsLyeHELmE38UfMGEAzdVerlYsADga4pNoZElkcB5QTrK/KvgZXnnYSperSCeA5vDgc7WpR+SCn3F0TkP4yU58I6XO6TtElObV5xoZ/vYN9ds0HLlv9H4PmdZQKBgQD/r1OvaIqqHcY38lS8jDtpnd4KfrbWkNvsHwB9zIpa8X3uNRxkNX9kA60B4rXLWJR+bEPWutB3V5nXECRsZGygAJxz4+3u/3IBQk2TZR5ZsaZEBHCO+luUvo7HpQALYOBNaGh6zB95mK/htqxpfK0pAlG4VC+7LZAv+XtTB3bkXwKBgQCruwcIqNcBVVZeIsaRovkPVz1xgG7CZ2x9N1zk0lRTF7fXBOf5wztn3fncnXv2Q+L3R/DRd4/yEClhpQ95ysH8cWEJOBrO357rEa0QP9QwPlUC5IIre5p648yqKcM0AEBpYfAnmh0Bz8V/FKhkh5YWQmo9PEPNkaJetFC1qQRoSwKBgQDAQJbOJ+9L5sNqwd4RP+hUjA2vGoRkZdvXeaAm9yt5ImgsOuc0Oj2leFYYOt2zHtHZFZMU3LdvZQEaAttAXWqIDK2XPmVj9dNFOxOVpszhaIC6WBRCjeFawMYfO+QCqj8+NSmKW/22sqZdM7wEPWj+ku3bigGx3pqyWAbw8YXmRQKBgAyIfs/r+p0XTFFcel+ApGqxNEPHWs4HXEybMMVmcE8MKRehPQjmbbx739NxDu3/MF5ZusKe1juVYF/G+yUpXhT9dVaF6Lb2bRO824OXFPZcZjnq0XE4+SJE49f7akquRgUq56sMPVe3gTNwH4YOuy5utHA5qL0lBtOgl09awX6XAoGBAPLpAyJUEp9+Rca/gH+JaL+RcKzVLzEhe0U/GVFFg8maSDmNniEe6FRVye+Ga5fcOoMVKepBFi4MIinsWYRRmxoEiPeNPSqKs6gTmjeF182WbCSfCcazbLTfAL6+/0JhjoDlEX25rD1t482eAfehrhiydmnr6zSRW8rSTFDwfkXF";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAgJtOGLCNq/WQDzosKuUZ9oZqw5BZzHd9XFS7hrn0qcupZscWoa2YmZuNR1wfIWTrTxBQ5Jkn0cuxFHZnaMo4yGf/zm9j8lEuZ1hKPjdL88XlVTIlJ5ndquoveSOMJDYMA/WkxxoQFCUDPLYigsg7cVuTmCIdYGqaMVQsa+moXKV3+EKCtf7IeCmAfTH/ytSM+psI1eyf4iwqtKepsn+MCsjUE+HGkLPwlPtbgJFILbUHgkdrbH8GIH1hbVONu6AbBuZXcstgdtX2nqp5ByfCdmyODztKyw/bDzDCCckq8E+Qkb9Gt6A2TAKJpNGwCtT6sUoSvR5Gzpkb7RtqITUzLQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://bjqkhx.natappfree.cc/alipay/notify";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost/success.html";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 数据格式
    public static String format = "JSON";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";

    //↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

